package io.lkt.modules.sys.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import io.lkt.common.utils.PageUtils;
import io.lkt.common.utils.Query;
import io.lkt.modules.sys.dao.BUserOpenidsDao;
import io.lkt.modules.sys.entity.BUserOpenidsLog;
import io.lkt.modules.sys.service.BUserOpenidsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class BUserOpenidsServiceImpl implements BUserOpenidsService {
    @Autowired
    private BUserOpenidsDao bUserOpenidsDao;

    @Override
    public PageUtils getUserOpenidsLogs(Map<String, Object> params) {
        IPage<BUserOpenidsLog> page = new Query().getPage(params);
        String gzhCode = params.get("gzhCode").toString();
        String comparisonDate = params.get("comparisonDate").toString();
        String baseDate = params.get("baseDate").toString();
        List<BUserOpenidsLog> list = bUserOpenidsDao.getUserOpenidsLogs(gzhCode, comparisonDate, baseDate);
        return new PageUtils(page.setRecords(list));
    }

    @Override
    public List<BUserOpenidsLog> rankFollow(Map<String, Object> params) {
        return bUserOpenidsDao.rankFollow(params);
    }

    @Override
    public int getCurrentMonthFollow(Map<String, Object> params) {
        return bUserOpenidsDao.getCurrentMonthFollow(params);
    }
}
